<template>
    <div class="Box">
        <div class="imgBox">
            <img :src="props.cover" @click="goVideo"/>
            <span>{{ voideoAllTime(props.duration) }}</span>
        </div>
        <div class="infoBox">
            <p @click="goVideo" class="title">{{ props.title }}</p>
            <div class="iconBox">
                <p>
                    <img src="@/assets/up/audioEj.png" alt="">
                    <span>{{ formatNum(props.play) }}</span>
                </p>
                <p>
                    <img src="@/assets/up/time.png" alt="">
                    <span>{{ formatIsYMD(props.ctime) }}</span>
                </p>
            </div>
        </div>
    </div> 
</template>

<script lang="ts" setup>
import { formatNum, formatIsYMD, voideoAllTime } from '@/utils/format'
import { useRouter } from 'vue-router'
interface Props{   
    id:number
    duration:number
    ctime:number
    title:string   
    play:number        
    cover:string
}
const props = defineProps<Props>()
const router = useRouter()

function goVideo(){
    // let routeData = router.resolve({path:'/video',query:{'avid':props.aid,'bvid':props.bvid,'cid':props.mid}})
    // window.open(routeData.href, '_blank');
}
</script>

<style lang="scss" scoped>
p{
    padding: 0;
    margin: 0;
}
.Box{
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: start;
    height: 100%;
    width: 100%;
    gap: 10px;
}
.imgBox{
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: calc(100% - 65px);
    & img:nth-child(1){
        width: 100%;
        height: 100%;
        border-radius: 4px;
        cursor: pointer;
    }
    & span:last-child{
        position: absolute;
        background: rgb(0, 0, 0,0.4);
        color: white;
        right: 0;
        bottom: 0;
        font-size: 12px;
        padding: 1px 7px;
        border-radius: 4px; 
    }
}
.infoBox{
    box-sizing: border-box;
    width: 100%;
    height: 55px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.title{
    line-height: 17px;
    font-size: 13px;
    color: #18191C;
    @include tweLineShow;
    height: 34px;
    text-align: left;
    cursor: pointer;
    &:hover{
        color:#00A1D6;
    }
}
.iconBox{
    display: flex;
    justify-content: start;
    align-items: center;
    font-size: 12px;
    line-height: 16px;
    gap: 0 25px;
    color: #999999;
    & p{
        @include flexRowCenter;
        gap: 0 5px;
    }
    & p img:nth-child(1){
        width: 16px;
    }
}
</style>